#include <iostream>
#include <string>
using namespace std;

//类做友元

class Building;

class GoodGay
{
public:

    void visit();//参观函数，访问Building中的属性
    GoodGay();
    Building* building;
};

class Building
{
    friend class GoodGay;//GoodGay是好朋友，可以访问私有成员

public:
    Building();

public:
    string livingRoom;//客厅

private:
    string bedRoom;//卧室
};

Building::Building()
{
    livingRoom = "客厅";
    bedRoom = "卧室";
}

GoodGay::GoodGay()
{
    //创建建筑物的对象
    building = new Building;
}

void GoodGay::visit()
{
    cout << "好基友类正在访问：" << building->livingRoom << endl;

    cout << "好基友类正在访问：" << building->bedRoom << endl;
}

void test1()
{
    GoodGay gg;
    gg.visit();
}

int main()
{
    test1();
    return 0;
}